Report the task directives read while the command is rendered - #7506
Conversation
Rendering the task command reads the directives it interpolates off the task config; record those reads so that an executor adjusting the resources at schedule time can tell whether the rendered command carries a value it is about to change. Being observed rather than inferred, this covers the script, a `shell` block, a `template` file and a dynamic directive value the command interpolates, in both parsers, without any of them being known to the check. A directive resolved after the command has been rendered is not covered. nf-seqera submits the affected tasks with prediction model `none`. Signed-off-by: Ben Sherman <bentshermann@gmail.com>
✅ Deploy Preview for nextflow-docs canceled.
|
|
Reviewed Two subtle details are already right, and both would have been easy to miss: recording happens before the cache lookup ( One thing I'd fix before merge —
This reaches A couple of smaller things:
Minor, for later: a cached top-level dynamic directive could mask a read ( On naming, one suggestion: private transient Set<String> accessedDirectives
private transient boolean trackingAccess
void trackDirectiveAccess(boolean value)
boolean isDirectiveAccessed(String directive)Two optional extras: bracketing the window as Update. I've pushed 30f08bf to this branch with the Two of the suggestions above didn't survive contact with the tests, so I left them out:
Also worth noting the |
- carry the accessed directives over to a task copy: the copy keeps the command that was rendered from them, therefore it depends on the same directives. TaskConfig#newCache no longer resets them, since the value cache belongs to a context while the access log belongs to a rendered command - rename the tracking to the `access` vocabulary: `record` reads as a noun in this codebase (TraceRecord, ProgressRecord, RecordMap, and the Java keyword) and `read` is ambiguous in a config class - note the paths that bypass TaskConfig#get, and the dynamic top-level directive whose nested access the value cache can hide - document that the check answers false before the command has been rendered, for a native `exec` task and for a task array - cover the absence of false positives, the task copy, and the config-file `ext.args` idiom through both config parsers Assisted-by: Claude Opus 5 (Claude Code) Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
State the three cases as a list, so the nested ternary reads as precedence rather than as a check: an explicit hint, then the automatic `task.memory` check, then null to inherit the run-level model. Assisted-by: Claude Opus 5 (Claude Code) Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Rendering the task command reads the directives it interpolates off the task config; record those reads so that an executor adjusting the resources at schedule time can tell whether the rendered command carries a value it is about to change.
Being observed rather than inferred, this covers the script, a
shellblock, atemplatefile and a dynamic directive value the command interpolates, in both parsers, without any of them being known to the check. A directive resolved after the command has been rendered is not covered.nf-seqera submits the affected tasks with prediction model
none.